// var as = document.getElementsByTagName('a');
// for(var i=0,j=as.length;i<j;i++){
//     var attr = as[i].getAttribute("href");
//     console.log(attr);
// }
$(function() {
  var dev = "http://114.113.68.14:9000/",
    prod = "http://www.3dzhixuan",
    local = "http://127.0.0.1:xxxx",
    location = "";
  var ip = window.location.host;
  for (var i = 0; i < $("a").length; i++) {
    var attr = $("a:eq(" + i + ")").attr("href");
    if (attr) {
      if (attr.indexOf(dev) > -1) {
        location = attr.substr(dev.length);
      } else if (attr.indexOf(prod) > -1) {
        location = attr.substr(dev.length);
      } else {
        location = attr.substr(dev.length);
      }
    }
    if (location) {
      if (ip.indexOf("127.0.0.1") >= 0 || ip.indexOf("localhost") >= 0) {
          $("a:eq(" + i + ")").attr("href", dev + location);
      } else {
        $("a:eq(" + i + ")").attr("href", ip + location);
      }
    }
  }
});
